package com.cj.mobile.iabp.app.global;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.widget.ImageView;

import com.blankj.utilcode.util.SDCardUtils;

/**
 * 包名： com.zqw.mobile.recyclingandroid.app.global
 * 对象名： Constant
 * 描述：公共设置
 * 作者： wly
 * 邮箱：wangliyang206@163.com
 * 创建日期： 2017/10/18 14:47
 */

public interface Constant {
    // 热更新版本，每次打补丁之前务必将版本号+1
    int HOTFIX_VERSION = 1;

    /*----------------------------------------------APP SdCard目录地址-------------------------------------------------*/

    /**
     * 图片路径
     */
    String IMAGE_PATH = SDCardUtils.getSDCardPathByEnvironment() + "/IABP/Image/";

    /**
     * 业务缓存目录
     */
    String CACHE_PATH = SDCardUtils.getSDCardPathByEnvironment() + "/IABP/Cache/";

    /**
     * APP升级路径
     */
    String APP_UPDATE_PATH = SDCardUtils.getSDCardPathByEnvironment() + "/IABP/AppUpdate/";

    /**
     * 视频缓存路径
     */
    String VIDEO_PATH = SDCardUtils.getSDCardPathByEnvironment() + "/IABP/Video/";

    /*----------------------------------------------------业务变量-------------------------------------------------------*/

    /**
     * IABP - 服务器地址
     */
    String IABP_SERVER_URL = "https://iabp.wecarenovo.com/";

    /**
     * 以下为路由侠地址
     * 每增加一个时，都需要在 {@link com.cj.mobile.iabp.mvp.ui.activity.SetServerAddressActivity}中的推荐项增加相应点击事项
     */

    /**
     * 杨津 - 路由侠地址
     */
    String ROUTING_MAN_URL_1 = "http://dev.chrd5.ipharma-mtm.cn:9996/iabp/";

    /**
     * 服务协议
     */
    String serviceAgreementUrl = "http://www.buypb.cn/useragreement/zqwservicegreement_jlt.html";

    /**
     * 隐私政策
     */
    String privacyPolicyUrl = "http://www.buypb.cn/useragreement/ruserprivacy_jlt.html";

    /**
     * 是否是消息通知打开的
     */
    String IS_MSG_OPEN = "isMsgOpen";

    /**
     * 接收自定义消息
     */
    String MESSAGE_RECEIVED_ACTION = "com.cj.mobile.iabp.MESSAGE_RECEIVED_ACTION";

    /**
     * API版本号
     */
    int version = 1;

    /**
     * 默认展示20条
     */
    int PAGESIZE = 20;

    /**
     * 正则：行开头、至少出现一次数字、(任意字符和至少出现一次数字)出现1次或0次、行结尾
     */
    String regular = "^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$";
    /*----------------------------------------------跳转设定---------------------------------------------*/
    public final int REQUEST_IMAGE = 2;
    public final int REQUEST_STORAGE_READ_ACCESS_PERMISSION = 101;

    /**
     * 出库重量
     */
    int OUTDEPOTWEIGHT = 0;

    /**
     * 选择 营业执照
     */
    int SELECT_IMG_BUSINESS_REQUESTCODE = 1;

    /**
     * 选择 危险品经营许可证
     */
    int SELECT_IMG_LICENSE_REQUESTCODE = 2;

    /**
     * 交货入库
     */
    int CREATEOUTBOUNDORDER_REQUESTCODE = 3;

    /**
     * 添加运单返回
     */
    int ADDWAYBILLACTIVITY_REQUESTCODE = 4;

    /**
     * 入库确认
     */
    int CONFIRMATION_STORAGE = 5;

    /**
     * 选择 公司门头
     */
    int SELECT_IMG_GSMT_REQUESTCODE = 6;

    /**
     * 选择 身份证
     */
    int SELECT_IMG_SFZ_REQUESTCODE = 7;

    /**
     * 选择转移联单返回
     */
    int SELECT_TRANSFER_ORDER_REQUESTCODE = 8;

    /**
     * 选择批次返回
     */
    int SELECT_BATCH_REQUESTCODE = 9;
    /**
     * 通讯录
     */
    int PICK_CONTACT = 10;
    /**
     * 图片参数key
     */
    String IMAGE_URL = "IMAGE_URL";

    /**
     * 订单号
     */
    String NUMBER = "number";

    /**
     * 平面翻转
     *
     * @param img1 需要设置动画的控件
     * @param type 旋转方向(ROTATE_DECREASE = 逆时针；ROTATE_INCREASE = 顺时针)
     */
    public static void rotationTriangle(ImageView img1, boolean type) {
        AnimatorSet animationSet = new AnimatorSet();
        ObjectAnimator scaleAnimation = null;
        if (type) {
            scaleAnimation = ObjectAnimator.ofFloat(img1, "rotationX", 0f, 180f);
        } else {
            scaleAnimation = ObjectAnimator.ofFloat(img1, "rotationX", 180f, 0f);
        }
        scaleAnimation.setDuration(800);
        animationSet.play(scaleAnimation);
        animationSet.start();
    }
}
